package com.zxjbyte.yiyi.framework.tenant.context;

/**
 * 多线程环境下存储和租户线程相关的数据
 * @Author zhangxingjia
 * @Date 2023/3/14 11:51
 * @Version: 1.0
 */
public class YiyiTenantContextHolder {

    /**
     * 是否忽略租户
     */
    private static final ThreadLocal<Boolean> TENANT_KEY_HOLDER = ThreadLocal.withInitial(() -> Boolean.FALSE);

    public static void setIgnore(Boolean ignore) {
        TENANT_KEY_HOLDER.set(ignore);
    }

    public static Boolean isIgnore() {
        return TENANT_KEY_HOLDER.get();
    }


    public static void clear() {
        TENANT_KEY_HOLDER.remove();
    }
}
